package com.ruoyi.iot.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.iot.vo.EquipVariablesVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 点位对象 coldefinetable
 * 
 * @author qiancheng
 * @date 2025-07-15
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("coldefinetable")
public class Coldefinetable extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** id */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /** 点位编号 */
    @TableField(value = "code")
    @Excel(name = "点位编号")
    private String code;

    /** 点位名称 */
    @Excel(name = "点位名称")
    @TableField(value = "name")
    private String name;

    @Excel(name = "点位位置",width = 30)
    @TableField(value = "area")
    private String area;

    /** 点位描述 */
    @Excel(name = "点位描述")
    @TableField(value = "description")
    private String description;

    /** 点位地址 */
    @Excel(name = "点位地址",width = 30)
    @TableField(value = "src")
    private String src;

    /** 数据类型 */
    @Excel(name = "数据类型")
    @TableField(value = "vartype")
    private String vartype;

    /** ip */
    @Excel(name = "ip")
    @TableField(value = "ip")
    private String ip;

    /** 备注2 */
    @Excel(name = "备注",width = 50)
    @TableField(value = "remark2")
    private String remark2;

    /** 变量英文名称 */
    @Excel(name = "变量英文名称")
    @TableField(value = "variable_en_name")
    private String variableEnName;

    public Coldefinetable(long snowflakeId, EquipVariablesVO coldefinetable) {
        this.setId(snowflakeId);
        this.setName(coldefinetable.getVariableName());
        this.setArea(coldefinetable.getPlcSrc());
        this.setDescription(coldefinetable.getVariableName());
        this.setSrc(coldefinetable.getPlcSrc());
        this.setIp(coldefinetable.getPlcIp());
        this.setVariableEnName(coldefinetable.getVariableEnName());
    }

}
